#include<bits/stdc++.h>
using namespace std;
int r[100005],s[100005],a[100005];
int main(){
  freopen("duel.in","r",stdin);
  freopen("duel.out","w",stdout);
    int n,m;
    cin>>n;
    m=n;
    for(int i=1;i<=n;i++){
        cin>>r[i];
        s[r[i]]++;
    }
    a[0]=n;
    for(int i=1;i<=100000;i++) a[i]=a[i-1]-s[i];
    for(int i=1;i<=100000;i++){
        if(s[i]<=a[i]) m-=s[i];
        else{
            cout<<s[i];
            return 0;
        }
    }
    cout<<m;
    return 0;
}
